#! /bin/bash

__check_result() {
    ret=$?
    echo "check result: $ret"
    if [ "$ret" != "0" ]; then
        exit 1
    fi
}

cd temp
[ -e tmp ] && rm -fr tmp
[ -f bootchart.png ] && rm bootchart.png
mkdir tmp
tar xvf bootchart.tgz -C tmp
__check_result
cd tmp
sed -i '$d' proc_ps.log
__check_result
[ -f "start" ] && rm "start"
tar zcvf bootchart.tgz *
java -jar ../../bootchart.jar bootchart.tgz
cp bootchart.png ../
cd ../
rm -fr tmp

